//
// Created by ASUS on 2024/5/25/星期六.
//
#include <bits/stdc++.h>
using namespace std;

vector<int> maxSlidingWindow(vector<int>& nums, int k) {
	int n = nums.size();
	priority_queue<pair<int, int>> pq;
	vector<int> ans;
	for (int i = 0; i < n; i++) {
		pq.push({nums[i], i});
		while (i - pq.top().second >= k)
			pq.pop();
		if (i >= k - 1) {
			ans.push_back(pq.top().first);
		}
	}
	return ans;
}